﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Transactions {
    import Engine.Classes.*;
    import Engine.Transactions.*;
    import Classes.*;

    public class TRedeemVisitorHelpAction extends Transaction {

        private var m_visitorId:String;
        private var m_targetId:uint;
        private var m_targetClass:String;
        private var m_targetName:String;
        private var m_action:String;

        public function TRedeemVisitorHelpAction(_arg1:String, _arg2:uint, _arg3:String="", _arg4:String="", _arg5:String=""){
            this.m_visitorId = _arg1;
            this.m_targetId = _arg2;
            this.m_targetClass = _arg3;
            this.m_targetName = _arg4;
            this.m_action = _arg5;
        }
        override public function perform():void{
            signedCall("VisitorService.redeemVisitorHelpAction", this.m_visitorId, this.m_targetId, this.m_targetClass, this.m_targetName, this.m_action);
        }
        override protected function onComplete(_arg1:Object):void{
            var _local2:MapResource;
            if (_arg1.rewardResult != null){
                if (((!((_arg1.rewardResult.doobers == null))) && (!((_arg1.rewardResult.secureRands == null))))){
                    _local2 = (Global.world.getObjectById(this.m_targetId) as MapResource);
                    if (_local2 != null){
                        _local2.parseAndCheckDooberResults(_arg1.rewardResult);
                    };
                };
            };
        }
        public function getWorldObject():WorldObject{
            return (Global.world.getObjectById(this.m_targetId));
        }
        public function getEquivalentTransaction(_arg1:WorldObject=null):Class{
            var _local2:WorldObject = ((_arg1 == null)) ? Global.world.getObjectById(this.m_targetId) : _arg1;
            var _local3:Class;
            if (!_local2){
                return (null);
            };
            switch (_local2.getClassName()){
                case "Residence":
                    _local3 = THarvest;
                    break;
                case "Wilderness":
                    _local3 = TClear;
                    break;
                case "Business":
                    break;
                case "Plot":
                case "Ship":
                    switch ((_local2 as HarvestableResource).getState()){
                        case HarvestableResource.STATE_WITHERED:
                            break;
                        case HarvestableResource.STATE_GROWN:
                            _local3 = THarvest;
                            break;
                        case HarvestableResource.STATE_PLANTED:
                            break;
                    };
                    break;
                case "ConstructionSite":
                    _local3 = TConstructionBuild;
                    break;
            };
            return (_local3);
        }

    }
}//package Transactions 
